<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>绝对定位练习</title>
    <style>
        div{
            width: 300px;/*不设置高度则高度自动识别内容高度*/
            background-color: rgba(0,0,0,0.3);
            padding: 10px;
            position: relative;/*做参照物*/

        }
        input{
            padding: 10px 20px;/*设置内边框*/
            width: 253px;
            border: 0;/*去掉边框 0或者none*/


        }
        img{
            position:absolute;
            left: 255px;
            top: 14px


        }
        p{
            font-size: 12px;
            color: red;
            margin: 0;
        }


    </style>



</head>
<body>
<div>
    <input type="text" placeholder="请输入用户名">
    <img src="http://doc.canglaoshi.org/tstore_v1/images/login/yhm.png" alt="">
    <p>用户名不能为空!</p>
</div>



</body>
</html>